"""
@file: user_models.py
@author：wang
@time: 2022/2/23 0023 13:39
"""
from apps.models import BaseModel
from exts import db


class User(BaseModel):
    username = db.Column(db.String(32), nullable=False, unique=True)
    password = db.Column(db.String(128))
    phone = db.Column(db.String(11), unique=True, nullable=False)
    icon = db.Column(db.String(256))
    newsList = db.relationship("News", backref="author")
    comments = db.relationship("Comment", backref="user")
    replys = db.relationship("Reply", backref="user")

    def __str__(self):
        return self.username
